<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Hardware Abstraction Layer (HAL)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="logo.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Hardware Abstraction Layer (HAL)</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('group__group__hal__hwmgr.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#groups">API Reference</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">HWMGR (Hardware Manager)<div class="ingroups"><a class="el" href="group__group__hal.html">HAL Drivers</a></div></div></div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<p >High level interface to the Hardware Manager. </p>
<h1><a class="anchor" id="section_hwmgr_features"></a>
Features</h1>
<ul>
<li>Allows HAL drivers or application firmware to mark specific hardware resources as reserved. When this is done, other reservation requests for the same resource will be denied.</li>
<li>For resources which are interchangeable such as clock dividers, provides allocation and reservation of an available instance.</li>
</ul>
<h1><a class="anchor" id="section_hwmgr_quickstart"></a>
Quick Start</h1>
<ul>
<li><a class="el" href="group__group__hal__hwmgr.html#ga903814cf5fa0cbc8c55c703a3275628c">cyhal_hwmgr_init</a> is used to initialize the hardware manager to keep track of resources being used.</li>
<li><a class="el" href="group__group__hal__hwmgr.html#ga33e7c9bb9beaedeb87825dadf604a0b9">cyhal_hwmgr_reserve</a> reserves a specified resource if available.</li>
<li><a class="el" href="group__group__hal__hwmgr.html#gaa1979bd596d90251c7b861a7e94b884f">cyhal_hwmgr_free</a> frees the specified resource.</li>
<li><a class="el" href="group__group__hal__hwmgr.html#ga16c02006114bccbf64acbdfd5f2066c2">cyhal_hwmgr_allocate</a> can be used to allocate a free block of specified resource, if available.</li>
</ul>
<h1><a class="anchor" id="section_hwmgr_snippets"></a>
Code snippets</h1>
<h2><a class="anchor" id="subsection_hwmgr_snippet_1"></a>
Snippet 1: Freeing a block used by PDL or configurators</h2>
<p >The following snippet shows how a specific resource used directly in PDL or the configurators can be freed so that it can be used by HAL.<br  />
</p>
<div class="fragment"><div class="line">    <span class="comment">// The resource that is being used</span></div>
<div class="line">    <a class="code hl_struct" href="group__group__hal__impl__hw__types.html#structcyhal__resource__inst__t">cyhal_resource_inst_t</a> resource =</div>
<div class="line">    {</div>
<div class="line">        .<a class="code hl_variable" href="group__group__hal__impl__hw__types.html#ad111187a65d182386ea96858369b83d4">type</a>        = <a class="code hl_enumvalue" href="group__group__hal__impl__hw__types.html#gga63b023ea7b5e73db59ddc0423c77975baa445456a2983f23d4be55613f2d09eb6">CYHAL_RSC_TCPWM</a>,</div>
<div class="line">        .block_num   = 0,</div>
<div class="line">        .channel_num = 3</div>
<div class="line">    };</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Use resource directly in PDL or configurators</span></div>
<div class="line"> </div>
<div class="line">    <span class="comment">// If the resource is no longer needed and can be used by the HAL, free the resource in Hardware</span></div>
<div class="line">    <span class="comment">// Manager</span></div>
<div class="line">    <a class="code hl_function" href="group__group__hal__hwmgr.html#gaa1979bd596d90251c7b861a7e94b884f">cyhal_hwmgr_free</a>(&amp;resource);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Disconnect any interconnects used between resources and pin</span></div>
<div class="line">    _cyhal_utils_disconnect_and_free(<a class="code hl_enumvalue" href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#gga707195ce0627016bf371643bdd9caa51a23d505c049c81443b12e53d5b00b1be9">P0_0</a>);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// resource can now be used by HAL</span></div>
<div class="line"> </div>
<div class="ttc" id="agroup__group__hal__hwmgr_html_gaa1979bd596d90251c7b861a7e94b884f"><div class="ttname"><a href="group__group__hal__hwmgr.html#gaa1979bd596d90251c7b861a7e94b884f">cyhal_hwmgr_free</a></div><div class="ttdeci">void cyhal_hwmgr_free(const cyhal_resource_inst_t *obj)</div><div class="ttdoc">Free the specified resource to allow it to be reused.</div><div class="ttdef"><b>Definition:</b> cyhal_hwmgr.c:204</div></div>
<div class="ttc" id="agroup__group__hal__impl__hw__types_html_ad111187a65d182386ea96858369b83d4"><div class="ttname"><a href="group__group__hal__impl__hw__types.html#ad111187a65d182386ea96858369b83d4">cyhal_resource_inst_t::type</a></div><div class="ttdeci">cyhal_resource_t type</div><div class="ttdoc">The resource block type.</div><div class="ttdef"><b>Definition:</b> cyhal_hw_resources.h:590</div></div>
<div class="ttc" id="agroup__group__hal__impl__hw__types_html_gga63b023ea7b5e73db59ddc0423c77975baa445456a2983f23d4be55613f2d09eb6"><div class="ttname"><a href="group__group__hal__impl__hw__types.html#gga63b023ea7b5e73db59ddc0423c77975baa445456a2983f23d4be55613f2d09eb6">CYHAL_RSC_TCPWM</a></div><div class="ttdeci">@ CYHAL_RSC_TCPWM</div><div class="ttdef"><b>Definition:</b> cyhal_hw_resources.h:235</div></div>
<div class="ttc" id="agroup__group__hal__impl__hw__types_html_structcyhal__resource__inst__t"><div class="ttname"><a href="group__group__hal__impl__hw__types.html#structcyhal__resource__inst__t">cyhal_resource_inst_t</a></div><div class="ttdoc">Represents a particular instance of a resource on the chip.</div><div class="ttdef"><b>Definition:</b> cyhal_hw_resources.h:589</div></div>
<div class="ttc" id="agroup__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble_html_gga707195ce0627016bf371643bdd9caa51a23d505c049c81443b12e53d5b00b1be9"><div class="ttname"><a href="group__group__hal__impl__pin__package__psoc6__01__104__m__csp__ble.html#gga707195ce0627016bf371643bdd9caa51a23d505c049c81443b12e53d5b00b1be9">P0_0</a></div><div class="ttdeci">@ P0_0</div><div class="ttdoc">Port 0 Pin 0.</div><div class="ttdef"><b>Definition:</b> cyhal_psoc6_01_104_m_csp_ble.h:55</div></div>
</div><!-- fragment --> <table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="groups" name="groups"></a>
API Reference</h2></td></tr>
<tr class="memitem:group__group__hal__results__hwmgr"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__results__hwmgr.html">HWMGR HAL Results</a></td></tr>
<tr class="memdesc:group__group__hal__results__hwmgr"><td class="mdescLeft">&#160;</td><td class="mdescRight">HWMGR specific return codes. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga903814cf5fa0cbc8c55c703a3275628c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__hwmgr.html#ga903814cf5fa0cbc8c55c703a3275628c">cyhal_hwmgr_init</a> (void)</td></tr>
<tr class="memdesc:ga903814cf5fa0cbc8c55c703a3275628c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes the hardware manager to keep track of what resources are being used.  <a href="group__group__hal__hwmgr.html#ga903814cf5fa0cbc8c55c703a3275628c">More...</a><br /></td></tr>
<tr class="separator:ga903814cf5fa0cbc8c55c703a3275628c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga33e7c9bb9beaedeb87825dadf604a0b9"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__hwmgr.html#ga33e7c9bb9beaedeb87825dadf604a0b9">cyhal_hwmgr_reserve</a> (const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__resource__inst__t">cyhal_resource_inst_t</a> *obj)</td></tr>
<tr class="memdesc:ga33e7c9bb9beaedeb87825dadf604a0b9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reserve the specified resource.  <a href="group__group__hal__hwmgr.html#ga33e7c9bb9beaedeb87825dadf604a0b9">More...</a><br /></td></tr>
<tr class="separator:ga33e7c9bb9beaedeb87825dadf604a0b9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa1979bd596d90251c7b861a7e94b884f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__hwmgr.html#gaa1979bd596d90251c7b861a7e94b884f">cyhal_hwmgr_free</a> (const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__resource__inst__t">cyhal_resource_inst_t</a> *obj)</td></tr>
<tr class="memdesc:gaa1979bd596d90251c7b861a7e94b884f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Free the specified resource to allow it to be reused.  <a href="group__group__hal__hwmgr.html#gaa1979bd596d90251c7b861a7e94b884f">More...</a><br /></td></tr>
<tr class="separator:gaa1979bd596d90251c7b861a7e94b884f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga16c02006114bccbf64acbdfd5f2066c2"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__hwmgr.html#ga16c02006114bccbf64acbdfd5f2066c2">cyhal_hwmgr_allocate</a> (<a class="el" href="group__group__hal__impl__hw__types.html#ga63b023ea7b5e73db59ddc0423c77975b">cyhal_resource_t</a> type, <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__resource__inst__t">cyhal_resource_inst_t</a> *obj)</td></tr>
<tr class="memdesc:ga16c02006114bccbf64acbdfd5f2066c2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocates a free block of the specified type if available This function is used when the exact block number and channel number of the resource is not known.  <a href="group__group__hal__hwmgr.html#ga16c02006114bccbf64acbdfd5f2066c2">More...</a><br /></td></tr>
<tr class="separator:ga16c02006114bccbf64acbdfd5f2066c2"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga903814cf5fa0cbc8c55c703a3275628c" name="ga903814cf5fa0cbc8c55c703a3275628c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga903814cf5fa0cbc8c55c703a3275628c">&#9670;&nbsp;</a></span>cyhal_hwmgr_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_hwmgr_init </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initializes the hardware manager to keep track of what resources are being used. </p>
<dl class="section return"><dt>Returns</dt><dd>The status of the init request </dd></dl>

</div>
</div>
<a id="ga33e7c9bb9beaedeb87825dadf604a0b9" name="ga33e7c9bb9beaedeb87825dadf604a0b9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga33e7c9bb9beaedeb87825dadf604a0b9">&#9670;&nbsp;</a></span>cyhal_hwmgr_reserve()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_hwmgr_reserve </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__resource__inst__t">cyhal_resource_inst_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reserve the specified resource. </p>
<p >The exact block number and channel number must be specified. If this is not know, use <a class="el" href="group__group__hal__hwmgr.html#ga16c02006114bccbf64acbdfd5f2066c2">cyhal_hwmgr_allocate</a>.</p>
<dl class="section note"><dt>Note</dt><dd>This function is called by the init function of hardware blocks. Calling this again for the same block will result in error since the hardware block is already marked as consumed.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The resource object that should be reserved </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the reserve request</dd></dl>
<p>See <a class="el" href="group__group__hal__hwmgr.html#subsection_hwmgr_snippet_1">Snippet 1: Freeing a block used by PDL or configurators</a> </p>

</div>
</div>
<a id="gaa1979bd596d90251c7b861a7e94b884f" name="gaa1979bd596d90251c7b861a7e94b884f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaa1979bd596d90251c7b861a7e94b884f">&#9670;&nbsp;</a></span>cyhal_hwmgr_free()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cyhal_hwmgr_free </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__resource__inst__t">cyhal_resource_inst_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Free the specified resource to allow it to be reused. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">obj</td><td>The resource object to free</td></tr>
  </table>
  </dd>
</dl>
<p>See <a class="el" href="group__group__hal__hwmgr.html#subsection_hwmgr_snippet_1">Snippet 1: Freeing a block used by PDL or configurators</a> </p>

</div>
</div>
<a id="ga16c02006114bccbf64acbdfd5f2066c2" name="ga16c02006114bccbf64acbdfd5f2066c2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga16c02006114bccbf64acbdfd5f2066c2">&#9670;&nbsp;</a></span>cyhal_hwmgr_allocate()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_hwmgr_allocate </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#ga63b023ea7b5e73db59ddc0423c77975b">cyhal_resource_t</a>&#160;</td>
          <td class="paramname"><em>type</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__resource__inst__t">cyhal_resource_inst_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Allocates a free block of the specified type if available This function is used when the exact block number and channel number of the resource is not known. </p>
<p >This function loops through all available resource of the specified type and assigns the resource if available. This function internally calls <a class="el" href="group__group__hal__hwmgr.html#ga33e7c9bb9beaedeb87825dadf604a0b9">cyhal_hwmgr_reserve</a> function and hence, it should not be called again.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">type</td><td>The type of resource to allocate. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">obj</td><td>The resource object. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the allocate request. </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>Hardware Abstraction Layer (HAL)</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
